
<?php if (isset($project)) { ?>
    
    

    <?php if (isset($SprintStories)){
        echo '<h1>'.'Sprint '.($this->params['pass'][1] + 1).': '.$this->Html->link(h($project['Project']['name']),'view/'.$project['Project']['id']).'</h1>';
       
    }
    else{
         ?>
                    <?php
                    echo '<h1>Proyecto :'.$this->Html->link(h($project['Project']['name']),'view/'.$project['Project']['id']).'</h1>';
                    ?>
                
         
         
         <a href="<?php echo $this->base; ?>/projects/backlog/<?php echo $project['Project']['id']; ?>" 
            class="btn btn-inverse pull-right"
            rel="tooltip" title="Vista Lista">
            <i class="icon-th-list icon-white"></i>
         </a>

         <a href="<?php echo $this->base; ?>/projects/backlogGrid/<?php echo $project['Project']['id']; ?>" 
            class="btn btn-inverse pull-right"
            rel="tooltip" title="Vista Grilla">
             <i class="icon-th icon-white"></i>
         </a>
             
         <?php
         
    }
    ?>
    <?php if (!isset($SprintStories)){?>
        <p><small>Created: <?php echo $project['Project']['created']; ?></small></p>
        <p><?php echo h($project['Project']['description']); ?></p>
    <?php } ?>
    
    <?php if (isset($SprintStories)){
        $project['Story']=$SprintStories;
    }
    ?>
    <div class="row-fluid">
        
    
    <br/><br/><br/><br/>
        
        <?php
       
       
        
        ?>
        <br/>

        <div class="row-fluid">
                
                <div class="span12">
                    <div id="myCarousel" class="carousel slide">
                        <?php 
                        $sprint="";
                        if (isset($this->params['pass'][1]))
                            $sprint='/'.($this->params['pass'][1]);
                        echo $this->Form->create(null,array('url' => '../stories/pokerPlanning/'.$project['Project']['id'].$sprint, 'class'=>'form-horizontal')); //array('url' => array('controller' => 'stories', 'action' => 'edit',$story['id']))
                        
                        ?>
                        
                        <input type="hidden" name="data[count]" value="<?php echo count($stories); ?>">
                        <?php 
                            
                            for ($i=0; $i<count($stories);$i++){ 
                                
                                ?>
                                <div class="item <?php if($i==0) echo 'active';?>">
                                    <div class="span12">
                                        <div class="span2">
                                            <br/>
                                            <?php  if($i>0){?>
                                            <div class="well" style="color: #999;">
                                                    <p> 
                                                        <strong> <?php echo $i;?> </strong>

                                                        <?php echo $stories[$i-1]['Story']['summary']?> 
                                                        <br/>
                                                        
                                                        <?php echo 'Sprint: '.($stories[$i]['Story']['sprint']); ?>
                                                    </p>
                                                    
                                            </div>
                                            <?php }?>
                                        </div>
                                        <div class="span8">
                                            <?php if (!isset($stories[$i]['color']))
                                                        $stories[$i]['Story']['color']='#FFF';
                                           
                                            if (($stories[$i]['Story']['color'])=="")
                                                        $stories[$i]['Story']['color']='#FFF';
                                                    ?>
                                            <div class="bs-docs-example" style="background-color:<?php echo $stories[$i]['Story']['color']?>; " id ="<?php echo $i;?>">
                                                
                                                <p> 

                                                    <?php echo '<h4>'.($i+1).'. '.$stories[$i]['Story']['summary'].'</h4>'?> 
                                                    <br/>
                                                    <?php echo $stories[$i]['Story']['detail']?> 
                                                    <br/><br/>
                                                    <?php //echo $this->Html->link('Sprint: '.($stories[$i]['Story']['sprint']+1),'backlogCard/'.$project['Project']['id'].'/'.$stories[$i]['Story']['sprint']); 
                                                    ?>
                                                </p>
                                                <br/><br/>
                                                    <div class="row-fluid" align="center">
                                                        
                                                        <input type="hidden" name="data[<?php echo $i; ?>][id]" value="<?php echo $stories[$i]['Story']['id'];?>">
                                                        <div class="span12">
                                                            <div class="span3">
                                                                
                                                                <label for="StoryPoints<?php echo $i;?>">
                                                                    <?php
                                                                        echo $this->Html->image('poker/question.png') ;
                                                                    ?>
                                                                </label>
                                                                <input type="radio" name="data[<?php echo $i; ?>][points]" id="StoryPoints<?php echo $i;?>" value="-1" checked="checked">
                                                            </div>
                                                            <div class="span3">
                                                                <label for="StoryPoints0-<?php echo $i;?>">
                                                                    <?php
                                                                        echo $this->Html->image('poker/0.png') ;
                                                                    ?>
                                                                </label>
                                                                <input type="radio" name="data[<?php echo $i; ?>][points]" id="StoryPoints0-<?php echo $i;?>" value="0">

                                                            </div>
                                                            <div class="span3">
                                                                <label for="StoryPoints1-<?php echo $i;?>">
                                                                    <?php
                                                                        echo $this->Html->image('poker/1.png') ;
                                                                    ?>
                                                                </label>
                                                                <input type="radio" name="data[<?php echo $i; ?>][points]" id="StoryPoints1-<?php echo $i;?>" value="1">
                                                            </div>
                                                            <div class="span3">
                                                                <label for="StoryPoints2-<?php echo $i;?>">
                                                                    <?php
                                                                        echo $this->Html->image('poker/2.png') ;
                                                                    ?>
                                                                </label>
                                                                <input type="radio" name="data[<?php echo $i; ?>][points]" id="StoryPoints2-<?php echo $i;?>" value="2">
                                                            </div>
                                                        </div>
                                                        <div class="span12"></div>
                                                        <div class="span12" >
                                                            <div class="span3">
                                                                <label for="StoryPoints3-<?php echo $i;?>">
                                                                    <?php
                                                                        echo $this->Html->image('poker/3.png') ;
                                                                    ?>
                                                                </label>
                                                                <input type="radio" name="data[<?php echo $i; ?>][points]" id="StoryPoints3-<?php echo $i;?>" value="3">

                                                            </div>
                                                            <div class="span3">
                                                                <label for="StoryPoints5-<?php echo $i;?>">
                                                                    <?php
                                                                        echo $this->Html->image('poker/5.png') ;
                                                                    ?>
                                                                </label>
                                                                <input type="radio" name="data[<?php echo $i; ?>][points]" id="StoryPoints5-<?php echo $i;?>" value="4">
                                                            </div>
                                                            <div class="span3">
                                                                <label for="StoryPoints8-<?php echo $i;?>">
                                                                    <?php
                                                                        echo $this->Html->image('poker/8.png') ;
                                                                    ?>
                                                                </label>
                                                                <input type="radio" name="data[<?php echo $i; ?>][points]" id="StoryPoints8-<?php echo $i;?>" value="5">

                                                            </div>
                                                            <div class="span3">
                                                                <label for="StoryPoints1000-<?php echo $i;?>">
                                                                    <?php
                                                                        echo $this->Html->image('poker/infinite.png') ;
                                                                    ?>
                                                                </label>
                                                                <input type="radio" name="data[<?php echo $i; ?>][points]" id="StoryPoints1000-<?php echo $i;?>" value="6">
                                                            </div>
                                                        </div>
                                                        <div class="span12"></div>
                                                        <div class="span12">
                                                            <textarea rows="3" name="data[<?php echo $i; ?>][detail]"  placeholder="Escriba su comentario.." style=" width: 600px;"></textarea>
                                                        </div>
                                                    </div>
                                            </div>
                                            
                                        </div>
                                        <div class="span2">
                                            <br/>
                                            <?php  if($i<(count($stories)-1)){?>
                                                <div class="well" style="color: #999;">
                                                    <p> 
                                                        <strong><?php echo $i+2;?></strong>

                                                        <?php echo $stories[$i]['Story']['summary']?> 
                                                        <br/>
                                                        
                                                        <?php echo 'Sprint: '.($stories[$i+1]['Story']['sprint']); ?>
                                                        
                                                    </p>
                                                    
                                                </div>
                                            <?php }?>
                                        </div>
                                    </div>
                                    

                                </div>
                           <?php  

                         }?>
                    <!--   Carousel nav -->
                    <a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;</a>
                    <a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;</a>
                    </div>
            </div>
        </div>
</div>
<br/><br/><br/>
<div class="span12" align="center">        
           <?php
                    $options = array(
                        'label' => 'Guardar PokerPlanning','class' => 'btn btn-success btn-large'
                    );
                    echo $this->Form->end($options);
                    ?>
</div>    
<?php } else {?>
    <br/>
    <div class="alert alert-info">
        Error de acceso.
    </div>
<?php }?>


